<?php
 defined('_JEXEC') or die('Restricted access');?>
 	 <script language="javascript" type="text/javascript">
	 
        window.addEvent( 'domready', function() {
         
                $('drop-down-he').addEvent( 'change', function() {
         				
						var valueHe= jQuery('#drop-down-he').val();
						alert(valueHe);
						jQuery('#drop-down-nganh').children().remove().end().append('<option selected value="0"> ---------------------------------</option>');
							jQuery('#drop-down-lop').children().remove().end().append('<option selected value="0"> ---------------------------------</option>');
                       // $('ajax-container').setHTML("Loading...");
                        var url = 'index.php?option=com_thoikhoabieu&task=ajaxnganh&format=raw&he='+valueHe;
                         new Ajax(url,{
                                method: 'post',
                                onComplete: function( response) {
                                var resp = Json.evaluate(response);
								jQuery.each(resp, function(val, text) { 
								 	jQuery('#drop-down-nganh').append(jQuery('<option></option>').val(val).html(text));
								});

                                }
                        }).request();
                });
				
			  $('drop-down-nganh').addEvent( 'change', function() {
         				
						var valueNganh= jQuery('#drop-down-nganh').val();
						var valueHe= jQuery('#drop-down-he').val();
						
						jQuery('#drop-down-lop').children().remove().end().append('<option selected value="0"> ---------------------------------</option>');
                       // $('ajax-container').setHTML("Loading...");
                        var url = 'index.php?option=com_thoikhoabieu&task=ajaxlop&format=raw&nganh='+valueNganh+'&he='+valueHe;
                         new Ajax(url,{
                                method: 'post',
                                onComplete: function( response) {
                                var resp = Json.evaluate(response);
								jQuery.each(resp, function(val, text) { 
								 	jQuery('#drop-down-lop').append(jQuery('<option></option>').val(val).html(text));
								});

                                }
                        }).request();
                });	
				
				
        });
		  
        
        </script>
 <?php
			echo '<h1 class="contentheading">Thời Khóa Biểu Theo Lớp</h1>';
			echo '<br/>';
			echo '<form id="tkb_lop" name="tkb_lopForm" method="post" action="index.php?option=com_thoikhoabieu&task=tkblop_detail">';
			$options = array();
			$options[] = JHTML::_( 'select.option', '0', '---------------------------------' );
			$options[] = JHTML::_( 'select.option', 'DH', 'Đại Học' );
			$options[] = JHTML::_( 'select.option', 'LT', 'Liên Thông' );
			$options[] = JHTML::_( 'select.option', 'CD', 'Cao Đẳng' );
			$options[] = JHTML::_( 'select.option', 'TC', 'Trung Cấp' );
			echo JText::_("Chọn Hệ:");
			echo JText::_("&nbsp;&nbsp;");
			echo JHTML::_( 'select.genericlist', $options, 'drop-down-he' );
			echo JText::_("Chọn Ngành:");
			echo JText::_("&nbsp;&nbsp;");
			$options_nganh = array();
			$options_nganh[] = JHTML::_( 'select.option', '0', '---------------------------------' );
			echo JHTML::_( 'select.genericlist', $options_nganh, 'drop-down-nganh');
			echo JText::_("Chọn Lớp:");
			echo JText::_("&nbsp;&nbsp;");
			$options_nganh = array();
			$options_nganh[] = JHTML::_( 'select.option', '0', '---------------------------------' );
			echo JHTML::_( 'select.genericlist', $options_nganh, 'drop-down-lop' );
			echo JText::_("&nbsp;&nbsp;");
            echo '<input type="submit" name="Submit" class="button" value="Xem" />';
        	echo '</form>';
?>